import request from '@/utils/request'
// 库存管理列表 -----------------------------------------------------------
export function inventoryList(listQuery) {
  return request({
    url: '/wms/inventory',
    method: 'get',
    params: listQuery
  })
}
// 库内管理导出全部
export function exportinventoryList(listQuery) {
  return request({
    url: '/wms/inventory/exportInventoryList',
    method: 'get',
    params: listQuery,
    timeout: 0
  })
}
// 员工管理导出全部
export function exportStaffList(listQuery) {
  return request({
    url: '/arpa-basic-api/staffs/exportStaffList',
    method: 'get',
    params: listQuery,
    timeout: 0
  })
}
// 系统管理/员工管理 部門查询下拉
export function getDepartmentList(code) {
  return request({
    url: `/arpa-basic-api/department/getDepartmentList?groupCode=${code}`,
    method: 'get'
  })
}
// 系统管理/员工管理 职位、劳务外包方下拉接口
export function listDict(code) {
  return request({
    url: `/arpa-basic-api/dict/listDict?types=${code}`,
    method: 'get'
  })
}
// 查询可用库存 -----------------------------------------------------------
export function inventoryCanUse(params) {
  return request({
    url: '/wms/inventory/listCanMoveInventory',
    method: 'get',
    params
  })
}

// 锁库存 -----------------------------------------------------------
export function inventoryLock(code) {
  return request({
    url: `/wms/inventory/lock/${code}`,
    method: 'get'
  })
}

// 锁库存 -----------------------------------------------------------
export function inventoryUnlock(code) {
  return request({
    url: `/wms/inventory/unlock/${code}`,
    method: 'get'
  })
}

// 查询库存明细 -----------------------------------------------------------
export function inventoryDetail(code) {
  return request({
    url: `/wms/inventory/${code}`,
    method: 'get'
  })
}

// 库存调整 -----------------------------------------------------------
export function inventoryAdjust(data) {
  return request({
    url: `/wms/inventory/lotAdjust`,
    method: 'post',
    data
  })
}

// 移位管理列表 -----------------------------------------------------------
export function moveList(listQuery) {
  return request({
    url: '/wms/move',
    method: 'get',
    params: listQuery
  })
}
// 移位单信息 -----------------------------------------------------------
export function moveDetail(code) {
  return request({
    url: `/wms/move/${code}`,
    method: 'get'
  })
}
// 移位单确认信息 -----------------------------------------------------------
export function moveConfirm(code) {
  return request({
    url: `/wms/move/getPCConfirmInfo`,
    method: 'get',
    params: { code: code }
  })
}
// 移位单确认提交 -----------------------------------------------------------
export function movePutConfirm(data) {
  return request({
    url: `/wms/move/confirm`,
    method: 'put',
    data
  })
}

// 移位单明细列表 -----------------------------------------------------------
export function moveItemList(listQuery) {
  return request({
    url: '/wms/moveItem',
    method: 'get',
    params: listQuery
  })
}

// 移位单新增 -----------------------------------------------------------
export function moveAdd(data) {
  return request({
    url: '/wms/move',
    method: 'post',
    data
  })
}

// 移位单修改 -----------------------------------------------------------
export function moveUpdate(data) {
  return request({
    url: '/wms/move',
    method: 'put',
    data
  })
}

// 移位单作废 -----------------------------------------------------------
export function moveBlank(params) {
  return request({
    url: '/wms/move/blank',
    method: 'put',
    params
  })
}

// 移位单审核 -----------------------------------------------------------
export function moveAudit(params) {
  return request({
    url: '/wms/move/audit',
    method: 'put',
    params
  })
}

// 盘点管理 -----------------------------------------------------------
// 列表查询
export function countingList(listQuery) {
  return request({
    url: '/wms/counting',
    method: 'get',
    params: listQuery
  })
}

// 新增
export function countingAdd(data) {
  return request({
    url: '/wms/counting',
    method: 'post',
    data
  })
}

// 新增盘点单页面提交操作
export function countingSubmit(data) {
  return request({
    url: '/wms/counting/submit',
    method: 'put',
    data
  })
}

// 修改
export function countingEdit(data) {
  return request({
    url: '/wms/counting',
    method: 'put',
    data
  })
}

// 详情
export function countingDetail(code) {
  return request({
    url: `/wms/counting/${code}`,
    method: 'get'
  })
}

// 删除
export function countingDelete(code) {
  return request({
    url: '/wms/counting',
    method: 'delete',
    params: { codes: code }
  })
}
// 提交
export function countingCheckSubmit(data) {
  return request({
    url: '/wms/counting/confirm',
    method: 'put',
    data
  })
}
// 保存
export function countingSaveSubmit(data) {
  return request({
    url: '/wms/counting',
    method: 'post',
    data
  })
}

export function countingRegister(data) {
  return request({
    url: '/wms/counting/register',
    method: 'post',
    data
  })
}

// 作废
export function countingInvalid(code) {
  return request({
    url: '/wms/counting/invalid/' + code,
    method: 'put'
  })
}

// 打印查询详情
export function registerList(code) {
  return request({
    url: `/wms/counting/registerDetail/${code}`,
    method: 'get',
    params: {
      pageSize: 1000
    }
  })
}
// 盘点登记详情
export function registerDetail(code) {
  return request({
    url: `/wms/counting/registerDetail/${code}`,
    method: 'get'
  })
}
// 盘点详情
export function countingDetailList(parm) {
  return request({
    url: `/wms/counting/registerDetail/${parm.code}`,
    method: 'get',
    params: parm
  })
}
// 盘点登记详情 - 分页
export function registerDetailPaginate(listQuery) {
  return request({
    url: `/wms/counting/registerDetail/${listQuery.code}`,
    method: 'get',
    params: listQuery
  })
}
// 领用管理 -----------------------------------------------------------
// 列表查询
export function collectList(listQuery) {
  return request({
    url: '/wms/collect',
    method: 'get',
    params: listQuery
  })
}

// 新增
export function collectAdd(data) {
  return request({
    url: '/wms/collect',
    method: 'post',
    data
  })
}

// 修改
export function collectEdit(data) {
  return request({
    url: '/wms/collect',
    method: 'put',
    data
  })
}

// 详情
export function collectDetail(code) {
  return request({
    url: `/wms/collect/${code}`,
    method: 'get'
  })
}

// 作废
export function collectInvalid(code) {
  return request({
    url: '/wms/collect/invalid',
    method: 'put',
    params: { code: code }
  })
}

// 审核
export function collectCheck(data) {
  return request({
    url: '/wms/collect/audit',
    method: 'put',
    data
  })
}
// 删除
export function collectDelete(code) {
  return request({
    url: '/wms/collect',
    method: 'delete',
    params: { codes: code }
  })
}

// 破损管理 -----------------------------------------------------------
// 列表查询
export function damagedList(listQuery) {
  return request({
    url: '/wms/damaged',
    method: 'get',
    params: listQuery
  })
}

// 新增
export function damagedAdd(data) {
  return request({
    url: '/wms/damaged',
    method: 'post',
    data
  })
}

// 修改
export function damagedEdit(data) {
  return request({
    url: '/wms/damaged',
    method: 'put',
    data
  })
}

// 详情
export function damagedDetail(code) {
  return request({
    url: `/wms/damaged/${code}`,
    method: 'get'
  })
}

// 删除
export function damagedDelete(code) {
  return request({
    url: '/wms/damaged',
    method: 'delete',
    params: { codes: code }
  })
}
// 作废
export function damagedInvalid(code) {
  return request({
    url: '/wms/damaged/blank',
    method: 'put',
    params: { code: code }
  })
}

// 审核
export function damagedCheck(data) {
  return request({
    url: '/wms/damaged/audit',
    method: 'put',
    data
  })
}
// 待返架列表
export function backRackList(listQuery) {
  return request({
    url: '/wms/inventory/backRackList',
    method: 'get',
    params: listQuery
  })
}
// 待返架 - 库存状态列表
export function chooseDataByAuthShipment() {
  return request({
    url: '/wms/inventoryStatus/chooseDataByAuthShipment',
    method: 'get'
  })
}
// 返架
export function backRack(data) {
  return request({
    url: '/wms/inventory/backRack',
    method: 'post',
    data
  })
}
// 期初管理 -----------------------------------------------------------
// 列表查询
export function initializationList(listQuery) {
  return request({
    url: '/wms/initialization',
    method: 'get',
    params: listQuery
  })
}

// 新增
export function initializationAdd(data) {
  return request({
    url: '/wms/initialization',
    method: 'post',
    data
  })
}

// 修改
export function initializationEdit(data) {
  return request({
    url: '/wms/initialization',
    method: 'put',
    data
  })
}

// 详情
export function initializationDetail(code) {
  return request({
    url: `/wms/initialization/${code}`,
    method: 'get'
  })
}
// new详情
export function getInitializationDetails(parms) {
  return request({
    url: `/wms/initialization/getInitializationDetails?${parms}`,
    method: 'get'
  })
}
// 获取 入驻商、单位、货品状态
export function shipmentUnitStatus() {
  return request({
    url: `/wms/warehouseShipment/business/shipmentsWithUnitAndInventoryStatus`,
    method: 'get'
  })
}

// 作废
export function initializationInvalid(code) {
  return request({
    url: '/wms/initialization/invalid',
    method: 'put',
    params: { code: code }
  })
}

// 审核
export function initializationCheck(data) {
  return request({
    url: '/wms/initialization/audit',
    method: 'put',
    data
  })
}
// 删除
export function initializationDelete(code) {
  return request({
    url: '/wms/initialization',
    method: 'delete',
    params: { codes: code }
  })
}

// 移位管理列表 -----------------------------------------------------------
export function differenceList(listQuery) {
  return request({
    url: '/wms/difference',
    method: 'get',
    params: listQuery
  })
}
// 移位单信息
export function differenceDetail(code) {
  return request({
    url: `/wms/difference/${code}`,
    method: 'get'
  })
}
// 移位单明细列表
export function differenceItemList(listQuery) {
  return request({
    url: '/wms/differenceItem',
    method: 'get',
    params: listQuery
  })
}

// 移位单新增
export function differenceAdd(data) {
  return request({
    url: '/wms/difference',
    method: 'post',
    data
  })
}

// 移位单修改
export function differenceUpdate(data) {
  return request({
    url: '/wms/difference',
    method: 'put',
    data
  })
}

// 移位单作废
export function differenceBlank(params) {
  return request({
    url: '/wms/difference/blank',
    method: 'put',
    params
  })
}

// 移位单审核
export function differenceAudit(params) {
  return request({
    url: '/wms/difference/audit',
    method: 'put',
    params
  })
}

// 任务中心列表 -----------------------------------------------------------
export function tasksList(listQuery) {
  return request({
    url: '/wms/tasks',
    method: 'get',
    params: listQuery
  })
}
// // 任务中心信息
// export function differenceDetail(code) {
//   return request({
//     url: `/wms/difference/${code}`,
//     method: 'get'
//   })
// }
// // 任务中心明细列表
// export function differenceItemList(listQuery) {
//   return request({
//     url: '/wms/differenceItem',
//     method: 'get',
//     params: listQuery
//   })
// }

// 下发单个任务
export function createTask(params) {
  return request({
    url: '/wms/tasks',
    method: 'post',
    params
  })
}

// 批量下发任务
export function createBatchTask(params) {
  return request({
    url: '/wms/tasks/batchIssue',
    method: 'get',
    params
  })
}
// 任务指派
export function tasksAssign(arr, userCode) {
  return request({
    url: '/wms/tasks/assign',
    method: 'post',
    params: { taskCodes: arr, userCode: userCode }
  })
}
// 取消指派
export function tasksUnAssign(arr) {
  return request({
    url: '/wms/tasks/unassign',
    method: 'post',
    params: { taskCodes: arr }
  })
}

// 详情
export function tasksDetail(code) {
  return request({
    url: `/wms/tasks/${code}`,
    method: 'get'
  })
}
// 调拨管理列表 -----------------------------------------------------------
export function allocationList(listQuery) {
  return request({
    url: '/wms/allocation',
    method: 'get',
    params: listQuery
  })
}
export function auditList(listQuery) {
  return request({
    url: '/wms/allocation/auditList',
    method: 'get',
    params: listQuery
  })
}

// 调拨单信息
export function allocationDetail(code) {
  return request({
    url: `/wms/allocation/${code}`,
    method: 'get'
  })
}

// 调拨单新增 - 调入仓库 下拉框数据
export function targetWarehouses(code) {
  return request({
    url: `/wms/allocation/targetWarehouses?shipmentCode=${code}`,
    method: 'get'
  })
}

// 调拨单新增
export function allocationAdd(data) {
  return request({
    url: '/wms/allocation',
    method: 'post',
    data
  })
}

// 调拨单修改
export function allocationEdit(data) {
  return request({
    url: '/wms/allocation',
    method: 'put',
    data
  })
}

// 调拨单作废
export function allocationBlank(code) {
  return request({
    url: '/wms/allocation/invalid',
    method: 'put',
    params: { code: code }
  })
}

// 调拨单审核
export function allocationAudit(data) {
  return request({
    url: '/wms/allocation/audit',
    method: 'put',
    data
  })
}
